#include <iostream>
#include <string>
#include <list>
#include <utility>
#include <sstream>
using namespace std;

class Solution 
{
public:
    string simplifyPath(string path) 
	{
        // Start typing your C/C++ solution below
        // DO NOT write int main() function
		if(path.size()<=1)
			return "/";

		typedef pair<size_t,size_t> SubStrIdx;
		SubStrIdx curIdx;
		list<SubStrIdx> idxes;
		curIdx.first = 0;
		for(size_t i=1;i<path.size();i++)
		{
			if(path[i] == '/')
			{
				if((i-curIdx.first)==3 && path.substr(curIdx.first+1,2)=="..")
				{
					if(!idxes.empty())
						idxes.pop_back();
				}
				else if((i-curIdx.first)>=2 && path.substr(curIdx.first+1,i-curIdx.first-1)!=".")
				{
					curIdx.second = i;
					idxes.push_back(curIdx);
				}

				curIdx.first = i;
			}
		}

		if(curIdx.first != (path.size()-1))
		{
			string lastStr = path.substr(curIdx.first+1,path.size()-curIdx.first-1); 
			if(lastStr == "..")
			{
				if(!idxes.empty())
					idxes.pop_back();
			}
			else if(lastStr != ".")
			{
				curIdx.second = path.size();
				idxes.push_back(curIdx);
			}
		}

		ostringstream oss;
		if(idxes.empty())
		{
			oss<<"/";
		}
		else
		{
			while(!idxes.empty())
			{
				SubStrIdx& idx = idxes.front();
				oss<<"/"<<path.substr(idx.first+1,idx.second-idx.first-1);
				idxes.pop_front();
			}
		}
		return oss.str();
    }
};

int main()
{
	string line;
	Solution s;
	while(getline(cin,line))
	{
		if(line == "")
			break;

		cout<<s.simplifyPath(line)<<endl;
	}
}